package com.gph.saviorframework.mq.service;

import com.alibaba.rocketmq.common.admin.TopicStatsTable;
import com.alibaba.rocketmq.common.protocol.body.TopicList;

import java.util.List;
import java.util.Map;

/**
 * MQ Topic Service
 *
 * @author guopeihui
 */
public interface TopicService {

    /**
     * 获取所有的topic名称
     * @return
     */
    List<String> getTopics();

    /**
     * 获取所有的topic
     * @return
     */
    TopicList getTopicList();

    /**
     * 创建或者更新topic
     * @param topic
     * @param readQueueNums
     * @param writeQueueNums
     * @param perm
     * @param brokerAddr
     * @param clusterName
     * @return
     */
    boolean update(String topic, String readQueueNums, String writeQueueNums, String perm,
                   String brokerAddr, String clusterName);

    /**
     * 删除topic
     * @param topicName
     * @param clusterName
     * @return
     */
    boolean delete(String topicName, String clusterName);

    /**
     * 获取topic状态
     * @param topicName
     * @return
     */
    TopicStatsTable getTopicStats(String topicName);

    /**
     * 获取topic状态的map结果集合，供controller使用
     * @param topicName
     * @return
     */
    List<Map<String,Object>> getTopicStatsMap(String topicName);
}
